package ynu.edu.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import ynu.edu.common.entity.LogicEntity;

import javax.persistence.*;

@Entity
@Getter
@Setter
public class ShopItem extends LogicEntity {
    //上架商品价格
    @Column
    private Double shopItemPrice;

    //1表示不上架,0表示上架
    @Column(insertable = false,
            nullable = false,
            columnDefinition="INT default 1")
    private Integer isOnShelves;

    @ManyToOne(cascade = CascadeType.MERGE,fetch = FetchType.EAGER)
    @JoinColumn(name = "shop_id")
    @JsonIgnoreProperties("shopItems")
    private Shop shop;

    @ManyToOne(cascade = CascadeType.MERGE,fetch = FetchType.EAGER)
    @JoinColumn(name = "item_id")
    @JsonIgnoreProperties("shopItems")
    private Item item;
}
